<template>
	<view class="index-box">
		<view class="logo-box">
			<img src="../../static/images/logo.png" class="logo-img" alt="">
		</view>

		<view class="today-class">
			<view class="title">今日课表</view>
			<view class="content">
				<uni-list-item v-for="(item,idx) in todayClass.classes" v-show="item.class_name" :key="idx"
					:title="item.class_name" :rightText="item.time"></uni-list-item>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'
	import {
		test_get
	} from '../../request/test_api.js'

	export default {
		data() {
			return {

			}
		},
		methods: {
			// 用户登录，获取code
			getLogin() {
				var that = this
				uni.login({
					success: (res) => {
						console.log(res.code)
					},
					fail: (err) => {
						console.log(err)
					}
				})
			}
		},
		computed: {
			...mapState({
				schedule: (state) => state.schedule.schedule,
				todayClass: (state) => state.schedule.todayClass
			}),
		},
		onLoad() {
			// 用户登录
			this.getLogin()
		}
	}
</script>

<style lang="scss">
	body,
	html {
		width: 100%;
		min-height: 100%;
		background-color: #f7f8fa;
	}

	.logo-box {
		background-color: #fff;

		.logo-img {
			display: block;
			margin: 0 auto;
			width: 600rpx;
			height: 450rpx;
		}
	}

	.today-class {
		padding: 20rpx;
		border: 3px solid #00b386;
		border-radius: 15rpx;
		margin: 20rpx 15rpx;

		.content {
			margin-top: 20rpx;

			.uni-list--border {
				display: none;
			}

			.uni-list-item {
				margin: 5rpx 0;
				border: none;
				border-radius: 10rpx;
			}
		}
	}
</style>